<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../VueJs/vue.js"></script>
</head>

<body>

    <div id="root">
        <ul>
            <li v-for="(item,index) in persons" :key="item.id">
                {{item.name}}--{{item.age}}--{{item.sex}}
            </li>
        </ul>
        <button @click="updateMei">更新马冬梅信息</button>
    </div>
</body>
<script>
    Vue.config.productionTip = false;
    Vue.config.devtools = true;

    const vm = new Vue({
        el: '#root',
        data: {
            persons: [
                { id: '001', name: '马冬梅', age: 18, sex: '女' },
                { id: '002', name: '周冬雨', age: 20, sex: '女' },
                { id: '003', name: '周杰伦', age: 45, sex: '男' },
                { id: '004', name: '最终版', age: 60, sex: '男' },
                { id: '005', name: 'mimi', age: 30, sex: '男' },
            ]
        },
        methods: {
            updateMei: function () {
                /* this.persons[0].name = '马老师';//可用
                this.persons[0].age = 100;//可用
                this.persons[0].sex = '男';//可用 */
                this.persons[0] = { id: '001', name: '马老师', age: 100, sex: '男' };//不可用
            }
        }
    });
</script>

</html>